{extend name="../../common/view/main"/}

{block name="style"}
<link href="__STATIC__/channel/css/main.min.css" type="text/css" rel="stylesheet">
{/block}

{block name="body"}

<div class="payment-section">
    <div class="pay-weixin" data-url="{:url('api/orders/detail', ['shopid' => $shopid, 'order_no' => $order_data['order_no']])}" data-order-no="{$order_data['order_no']}"> 
		<div class="pay-info clearfix">
			<!--订单号-->
			<div class="col-xs-6">
				订单号：<span class="order-no ">{$order_data['order_no']}</span>
			</div>
			<!--支付金额-->
			<div class="col-xs-6">
				支付金额：<span class="paid-fee">￥ {$order_data['paid_fee']}</span>
			</div>
		</div>
		<div class="qrcode">
			<img src="{$code_url}" />
		</div>
		
		<div class="tip">
			<img src="__STATIC__/common/images/Weqrcode.png" />
		</div>
    </div>
</div>
{/block}

{block name="script"}
<script>
	$(function(){
		var url = $('.pay-weixin').data('url');
		var data = {
			'order_no' : $('.pay-weixin').data('order-no'),
		};
		var qrcode_pay_expire = setInterval(function(){
            $.post(url,data,function($res){
              if($res.code == 200 && $res.data.paid == 1){
                window.clearInterval(qrcode_pay_expire);
                //支付成功业务逻辑
                toast.success('支付成功，页面即将跳转~', 'success');
                setTimeout(function(){
                  //设置二维码过期
                  location.href = $res.url;
                }, 1500);
              }
            });
          }, 1000);
	})
</script>
{/block}